package com.cimu.provider.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.cimu.provider.service.AsyncService;
import com.cimu.provider.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Title: AsyncServiceImpl
 * Copyright: Copyright (c) 2017
 *
 * date 2018年12月06日 14:21
 */
@Service(interfaceClass = AsyncService.class,async = true, registry = {"test"})
@Component
@Slf4j
public class AsyncServiceImpl implements AsyncService{
    @Autowired
    private UserService userService;

    @Override
    public void saveUser() {
        try {
            //模拟保存时间很长
            Thread.sleep(1000*20);
            userService.getById(1L);
        } catch (InterruptedException e) {
            log.error("异常",e);
        }

    }

}
